#include "WidgetVariantTable.h"
#include "ui_WidgetVariantTable.h"
#include <QtWidgets/QFileDialog>
#include <iostream>


WidgetVariantTable::WidgetVariantTable(QWidget *parent) :
    WidgetVariant(parent),
    ui(new Ui::WidgetVariantTable)
{
    ui->setupUi(this);
    QObject::connect(ui->buttonRead, SIGNAL(clicked(bool)), this, SLOT(slotButtonOpen(bool)));
    m_tableOut = ui->tableWidget;

}

WidgetVariantTable::~WidgetVariantTable()
{
    delete ui;
}

void WidgetVariantTable::refreshByProperty(EItemMetaPropertyPtr p)
{
    /*
    WidgetVariant::refreshByProperty(property );

    ui->labelName->setText( property.nameCN.isEmpty() ? property.name : property.nameCN );

    readExcelFile(property.value.toString());
    */
}

void WidgetVariantTable::slotButtonOpen(bool boolValue)
{

    QString fileName = QFileDialog::getOpenFileName(this, tr("Open data"), "data/", tr("Excel Files (*.xlsx)"));
    std::cout<<"WidgetVariantTable::slotButtonOpen fileName="<<fileName.toLocal8Bit().data()<<"\n";


}

